﻿using System.Collections.Generic;
using System.Web.Http;
using Pansoft.HIME.Base.Interfaces;
using Pansoft.HIME.Base.ViewModels.Statistics;

namespace Pansoft.HIME.Controllers.Api.Statistics
{
    public class SatisfactoryStatisticsController:ApiController
    {
        private readonly ISatisfactoryRepository _SatisfactoryRepository;
        public SatisfactoryStatisticsController(ISatisfactoryRepository satisfactoryRepository)
        {
            _SatisfactoryRepository = satisfactoryRepository;
        }

        public BatchDataViewModel<SatisfactoryStatisticsViewModel> Post(QueryParam queryParam)
        {
            int totalcount;
            var result = _SatisfactoryRepository.Get(queryParam,out totalcount);
            if (totalcount == 0)
            {
                return new BatchDataViewModel<SatisfactoryStatisticsViewModel>( new List<SatisfactoryStatisticsViewModel>(),0);
            }
            return new BatchDataViewModel < SatisfactoryStatisticsViewModel >(result,totalcount);
        }
    }
}